<template>
  <view class="wrap">
    <view class="news-item" v-for="(item, index) in feelist">
      <image class="news-image" :src="item.pic" mode="aspectFill" @click="showDetail(item)"></image>
      <view class="news-info">
        <view class="news-title">{{ item.title }}</view>
        <view class="news-meta">
          <text class="news-author">{{ item.author }}</text>
          <text class="news-time">{{ item.publish_date }}</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script>


export default {
  data() {
    return {
      feelist: [],
      selectedNews: {},
      show: false
      // desc: '众多的贴心小工具，是你开发过程中召之即来的利器，让你飞镖在手，百步穿杨'
    }
  },
  computed: {
    getIcon() {
      return path => {
        return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
      }
    },
    desc() {
      return this.$t('js.desc');
    }
  },
  created() {
    this.newList()
  },
  onShow() {
    uni.setNavigationBarTitle({
      title: this.$t('nav.js')
    });
  },
  methods: {
    showDetail(news) {
      // this.selectedNews = news;
      // this.show = true
      this.$u.route({
        url: 'pages/example/detail?id=' + news.id
      })
    },

    newList() {
      this.$u.get('/news/list', {
        pageSize: 10000
      }).then(res => {
        console.log(res)
        this.feelist = res.list;
      })
    },
  }
}
</script>

<style>
/* page {
  background-color: rgb(240, 242, 244);
} */
</style>

<style lang="scss" scoped>
.wrap {
  padding: 24 rpx;
}

.u-row {
  margin: 40 rpx 0;
}

.demo-layout {
  height: 80 rpx;
  border-radius: 8 rpx;
}

.bg-purple {
  background: #d3dce6;
}

.bg-purple-light {
  background: #e5e9f2;
}

.bg-purple-dark {
  background: #99a9bf;
}

.u-cell-icon {
  width: 36 rpx;
  height: 36 rpx;
  margin-right: 8 rpx;
}

.jingdong {
  margin-top: 40 rpx;
  width: 700 rpx;
  height: auto;
  background-color: #ffffff;
  display: flex;

  .left {
    padding: 0 30 rpx;
    //background-color: rgb(95, 148, 224); //rgb(94, 152, 225);
    text-align: center;
    //font-size: 28 rpx;
    width: 40%;
    //color: #ffffff;

    .sum {
      margin-top: 50 rpx;
      font-weight: bold;
      font-size: 32 rpx;

      .num {
        font-size: 80 rpx;
      }
    }

    .type {
      margin-bottom: 50 rpx;
      font-size: 24 rpx;
    }
  }

  .right {
    padding: 20 rpx 20 rpx 0;
    font-size: 28 rpx;
    margin-left: 20 rpx;

    .top {
      border-bottom: 2 rpx dashed $u-border-color;

      .title {
        margin-right: 60 rpx;
        line-height: 40 rpx;

        .tag {
          padding: 4 rpx 20 rpx;
          background-color: rgb(73, 154, 201);
          border-radius: 20 rpx;
          color: #ffffff;
          font-weight: bold;
          font-size: 24 rpx;
          margin-right: 10 rpx;
        }
      }

      .bottom {
        display: flex;
        margin-top: 20 rpx;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 10 rpx;

        .date {
          font-size: 20 rpx;
          flex: 1;
        }

        .immediate-use {
          height: auto;
          padding: 0 20 rpx;
          font-size: 24 rpx;
          border-radius: 40 rpx;
          line-height: 40 rpx;
          color: rgb(117, 142, 165);
          border: 2 rpx solid rgb(117, 142, 165);
        }
      }
    }

    .tips {
      width: 100%;
      line-height: 50 rpx;
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 24 rpx;

      .transpond {
        margin-right: 10 rpx;
      }

      .explain {
        display: flex;
        align-items: center;
      }

      .particulars {
        width: 30 rpx;
        height: 30 rpx;
        box-sizing: border-box;
        padding-top: 8 rpx;
        border-radius: 50%;
        background-color: $u-type-info-disabled;
        text-align: center;
      }
    }
  }
}

.news-item {
  display: flex;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #eee;
}

.news-image {
  width: 100px;
  height: 100px;
  margin-right: 10px;
}

.news-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.news-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 5px;
}

.news-meta {
  display: flex;
  align-items: center;
  color: #666;
}

.news-author {
  margin-right: 10px;
}

.news-time {
  font-size: 12px;
}

.modal-content {
  padding: 10px;
}

.news-content {
  line-height: 1.5em;
  text-indent: 2em;
}
</style>
